#ifndef JSONHANDLE_H
#define JSONHANDLE_H

#include <QObject>
#include <QFile>
#include <QDebug>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonParseError>
#include <QJsonValue>

#include "common.h"
#include "format.h"

//支持json到数据结构的双向转换
class JsonHandle : public QObject
{
    Q_OBJECT
public:
    explicit JsonHandle(QObject *parent = 0);
    Format* createFormatData(const QString &path);

    void getPathPrefix(Format *format, QJsonObject root_obj);
    void getVideoStreams(Format *format, QJsonObject root_obj);
    void getArchitectureVersion(Format *format, QJsonObject root_obj);
    void getCurrentShow(Format *format, QJsonObject root_obj);
    void getResolution(Format *format, QJsonObject root_obj);
    void getResources(Format *format, QJsonObject root_obj);
    void getScreens(Format *format, QJsonObject root_obj);

    void savePathPrefix(QJsonObject &format_obj, Format *format);
    void saveVideoStreams(QJsonObject &format_obj, Format *format);
    void saveArchitectureVersion(QJsonObject &format_obj, Format *format);
    void saveCurrentShow(QJsonObject &format_obj, Format *format);
    void saveResolution(QJsonObject &format_obj, Format *format);
    void saveResources(QJsonObject &format_obj, Format *format);
    void saveScreens(QJsonObject &format_obj, Format *format);

    void saveFormatData(Format *format, const QString &path);
signals:

public slots:
};

#endif // JSONHANDLE_H
